import { createRouter, createWebHashHistory } from 'vue-router'
import Layout from '@/views/Layout'
const routes = [
  {
    path: '/',
    component: Layout,
    children: [
      {
        path: '/', component: () => import('@/views/Home')
      },
      {
        path: 'cart', component: () => import('@/views/Cart')
      },
      {
        path: 'category/:id', component: () => import('@/views/Category')
      },
      {
        path: 'category/sub/:id', component: () => import('@/views/Category/Sub')
      },
      {
        path: 'goods/:id', component: () => import('@/views/Goods')
      },
      {
        path: '/cart', component: () => import('@/views/Cart')
      },
      {
        path: '/settlement', component: () => import('@/views/Settlement')
      },
      {
        path: '/pay', component: () => import('@/views/Pay')
      },
      {
        path: '/pay/callback', component: () => import('@/views/Pay/callback.vue')
      },
      {
        path: '/member',
        component: () => import('@/views/Member/layout'),
        children: [
          { path: '', component: () => import('@/views/Member/Home') },
          { path: 'order', component: () => import('@/views/Member/Order') }
        ]
      }
    ]
  },
  {
    path: '/login',
    component: () => import('@/views/Login')
  },
  {
    path: '/login/callback',
    component: () => import('@/views/Login/callback')
  },
  {
    path: '/playground',
    component: () => import('@/views/Playground')
  }
]
// vue2语法 new vueRouter({routes})
const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
